<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload = function () {
            var code = document.getElementById("chekccode");
            var change = document.getElementById("change");

            // code.onclick = function (ev) {
            //     var time = new Date().getTime();
            //     code.src = "/javaee/checkCodeServlet?" + time;
            // }
            change.onclick = changeCode;
            code.onclick = changeCode;
        }

        function changeCode() {
            var code = document.getElementById("chekccode");
            var time = new Date().getTime();
            code.src = "/javaee/checkCodeServlet?" + time;
        }
    </script>
</head>
<body>

<img id="chekccode" src="/javaee/checkCodeServlet">
<a id="change" href="javascript:void(0)">看不清, 换一张</a>

</body>
</html>